package main;

import org.apache.commons.io.FileUtils;
import org.apache.ibatis.annotations.Delete;
import org.mybatis.generator.api.ShellRunner;

import javax.sound.midi.Soundbank;
import java.io.File;
import java.io.IOException;

public class GenMain {


    public static void main(String[] args) throws Exception {

        //删除com下所有文件
        deleteAll("src/main/java/com");

        String root = GenMain.class.getResource("/").getPath();
        String path = root + "generatorConfig.xml";
        //-overwrite 无效-因为已自定义删除文件
        args = new String[]{"-configfile", path, "-overwrite"};
        //ShellRunner.main(args);
        MyShellRunner.main(args);
    }

    private static void deleteAll(String path) throws IOException {
        File file = new File(path);
        FileUtils.deleteDirectory(file);
    }

}